package game.controler.gestionnaires.conversation;

import game.impl.conversation.reponse.*;
import game.model.conversation.Reponse;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author Gab'z
 */
public class GestionnaireReponses {

    private static GestionnaireReponses GReponses = null;
    private HashMap listeReponses = new HashMap<String, Reponse>();

    public GestionnaireReponses() {
        System.out.println("Initialisation des Reponses");
        initialiserReponses();
    }

    public static GestionnaireReponses getGReponse() {
        if (GReponses == null) {
            GReponses = new GestionnaireReponses();
        }
        return GReponses;
    }

    public Reponse getReponse(String ID) {
        return (Reponse) listeReponses.get(ID);
    }

    private void initialiserReponses() {
        // A répéter pour chaque Reponse du jeu
        ajouterReponse(new rf_crazy_1());
        ajouterReponse(new rf_crazy_2());
        ajouterReponse(new rf_crazy_3());
        ajouterReponse(new rp_medecin_intro_0());
        ajouterReponse(new rp_medecin_intro_1());
        ajouterReponse(new rp_medecin_intro_2());
        ajouterReponse(new rp_medecin_intro_3());
        ajouterReponse(new rp_medecin_intro_4());
        ajouterReponse(new rp_medecin_intro_5());
        ajouterReponse(new rp_medecin_intro_6());
        ajouterReponse(new rp_medecin_intro_7());
        ajouterReponse(new rp_medecin_intro_8());
        
        // réponses pour le fou oiseau
        ajouterReponse(new rf_oiseau_0());
        ajouterReponse(new rf_oiseau_1());
        ajouterReponse(new rf_oiseau_2());
        ajouterReponse(new rf_oiseau_3());
        ajouterReponse(new rf_oiseau_4());
        ajouterReponse(new rf_oiseau_7());
        ajouterReponse(new rf_oiseau_8());
        ajouterReponse(new rf_oiseau_9());
    }

    private void ajouterReponse(Reponse reponse) {
        listeReponses.put(reponse.getId(), reponse);
    }

    public ArrayList<Reponse> getReponsesForDialogue(ArrayList<String> idReponses) {
        ArrayList<Reponse> listeReponsesDialogue = new ArrayList<Reponse>(0);
        for (String idReponse : idReponses) {
            listeReponsesDialogue.add(getReponse(idReponse));
        }
        return listeReponsesDialogue;
    }
}
